package com.eascs.web.o2o.web.bi.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.eascs.web.api.ApiMethod;
import com.eascs.web.api.ApiRequest;
import com.eascs.web.api.ApiResponse;
import com.eascs.web.api.BaseApiController;
import com.eascs.web.o2o.web.bi.entity.BICompensatory;
import com.eascs.web.o2o.web.bi.entity.BICompensatoryDetail;
import com.eascs.web.o2o.web.bi.entity.BICost;
import com.eascs.web.o2o.web.bi.entity.BILoanDetail;
import com.eascs.web.o2o.web.bi.entity.BILoanInfo;
import com.eascs.web.o2o.web.bi.entity.BIOverdue;
import com.eascs.web.o2o.web.bi.entity.BIOverdueDetail;
import com.eascs.web.o2o.web.bi.entity.BIReceivableDetail;
import com.eascs.web.o2o.web.bi.service.CompensatoryService;
import com.eascs.web.o2o.web.bi.service.CostService;
import com.eascs.web.o2o.web.bi.service.LoanInfoService;
import com.eascs.web.o2o.web.bi.service.OverdueService;
import com.eascs.web.o2o.web.bi.service.ReceivableService;
import com.eascs.web.o2o.web.bi.vo.LoanDetailForm;

/**
 * BI 财务接口
 * 
 * @author ycz
 *
 */
@RestController
@RequestMapping("/o2o")
public class BIController extends BaseApiController {
	@Autowired
	private LoanInfoService loanInfoService;
	@Autowired
	private OverdueService overdueService;
	@Autowired
	private CompensatoryService compensatoryService;
	@Autowired
	private CostService costService;
	@Autowired
	private ReceivableService receivableService;

	@RequestMapping(value = "/api/execute")
	public ApiResponse execute(ApiRequest apiRequest,HttpServletRequest request) {
		return super.execute(apiRequest,request);
	}

	@ApiMethod
	public  List<BICompensatory> queryListCompensatory() {
		return compensatoryService.queryCompensatory();
	}
	/**
	 * 放款信息
	 * @return
	 */
	@ApiMethod
	public List<BILoanInfo> queryListLoanInfo() {
		return loanInfoService.queryLoanInfo();
	}
	/**
	 * 逾期信息
	 * @return
	 */
	@ApiMethod
	public List<BIOverdue> queryListOverdue() {
		return overdueService.queryOverdue();
	}
	
	/**
	 * 费用信息（保证金、管理费、风险补偿金）
	 * @return
	 */
	@ApiMethod
	public List<BICost> queryCost() {
		return costService.queryCost();
	}
	
	/**
	 * 放款明细
	 * @return
	 */
	@ApiMethod
	public List<BILoanDetail> queryLoanDetailByPage(LoanDetailForm loanDetailForm) {
		return loanInfoService.findLoanDetailByPage(loanDetailForm);
	}
	
	/**
	 * 逾期明细
	 * @return
	 */
	@ApiMethod
	public List<BIOverdueDetail> queryOverdueDetailByPage(LoanDetailForm loanDetailForm) {
		return overdueService.findOverdueDetailByPage(loanDetailForm);
	}
	
	/**
	 * 代偿明细
	 * @return
	 */
	@ApiMethod
	public List<BICompensatoryDetail> querycompensatoryDetailByPage(LoanDetailForm loanDetailForm) {
		return compensatoryService.findcompensatoryDetailByPage(loanDetailForm);
	}
	
	/**
	 * 回款明细
	 * @return
	 */
	@ApiMethod
	public List<BIReceivableDetail> queryReceivableDetailByPage(LoanDetailForm loanDetailForm) {
		return receivableService.findReceivableDetailByPage(loanDetailForm);
	}
}
